package com.code.ddbond.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.code.ddbond.pojo.UserInfo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface UserInfoMapper extends BaseMapper<UserInfo>
{
      UserInfo selectByUserName(String username);
      @Select("SELECT COUNT(*) FROM user_info WHERE email = #{email}")
      int checkEmailExistence(String email);
      @Update("UPDATE user_info SET pwd = #{newPassword} WHERE email = #{email}")
      int updatePasswordByEmail(String email, String newPassword);
      @Select("SELECT COUNT(*) FROM user_info WHERE login_name = #{loginname}")
      boolean existsByLoginname(String loginname);
}
